home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue56 / Construc / Unit3.pas < prev   
Encoding:
Pascal/Delphi Source File  |  2000-03-02  |  1.4 KB  |  64 lines

  1. unit Unit3;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  5.   StdCtrls;
  6.  
  7. type
  8.   TForm3 = class(TForm)
  9.     Button1: TButton;
  10.     Memo1: TMemo;
  11.     Button2: TButton;
  12.     procedure Button1Click(Sender: TObject);
  13.     procedure Button2Click(Sender: TObject);
  14.   private
  15.     { Private declarations }
  16.   public
  17.     { Public declarations }
  18.   end;
  19.  
  20. var
  21.   Form3: TForm3;
  22.  
  23. implementation
  24. {$R *.DFM}
  25. uses
  26.   CORBA, OrbPas30, CorbaObj, BobNotes_I, BobNotes_C;
  27.  
  28. procedure TForm3.Button1Click(Sender: TObject);
  29. var
  30.   Factory: CorBobNotesFactory;
  31.   Client: ICorBobNotes;
  32.   Lines: WideString;
  33. begin
  34.   Factory := TCorBobNotesFactoryHelper.Bind('CorBobNotes');
  35.   Client := Factory.CreateInstance('CorBobNotes');
  36.   Client.GetLines('Bob','swart',Lines);
  37.   Memo1.Lines.Add(Lines);
  38.   Client := nil;
  39.   Factory := nil
  40. end;
  41.  
  42. procedure TForm3.Button2Click(Sender: TObject);
  43. var
  44.   Factory,Client: TAny;
  45.   Lines: WideString;
  46.   User,Pass: WideString;
  47. begin
  48.   Factory := Orb.Bind('IDL:BobNotes/CorBobNotesFactory:1.0');
  49.   Client := Factory.CreateInstance('CorBobNotes');
  50.   User := 'Bob';
  51.   Pass := 'swart';
  52.   try
  53.     Client.GetLines(User,Pass,Lines);
  54.   except
  55.     on E: EICorBobnotes_PermissionDenied do
  56.       Memo1.Lines.Add(E.Reason)
  57.   end;
  58.   Memo1.Lines.Add(Lines);
  59.   Client := unassigned;
  60.   Factory := unassigned;
  61. end;
  62.  
  63. end.
  64.